<template>
  <div>
    <my-item v-for="item in list" :key="item.id" :item="item"></my-item>
  </div>
</template>

<script setup>
import MyItem from "./MyItem.vue";
import { useBodyHttpHook } from "./Hooks/useBodyHooks";
import mitts from "../bus";
const { list } = useBodyHttpHook();
watch(list, (newval) => {
  // console.log(newval); // Proxy(Array)
  mitts.emit("giveList", newval);
});
mitts.on("delItems", () => {
  list.value = list.value.filter((item) => item.isSelected === false);
});
mitts.on("changeOpp", () => {
  list.value.forEach((item) => {
    item.isSelected = !item.isSelected;
  });
  // debugger
});
</script>

<style lang="scss" scoped></style>
